package config;

import java.nio.charset.Charset;
import java.util.Arrays;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Controller;
//import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;


//@ComponentScan(basePackages={"com.*"},
//		excludeFilters={@ComponentScan.Filter(type= FilterType.ANNOTATION,classes={Controller.class})},useDefaultFilters=false)
public class WebConfig {
 @Bean
 public RequestMappingHandlerAdapter getRequestMappingHandlerAdapter(){
     RequestMappingHandlerAdapter adapter = new RequestMappingHandlerAdapter();

	 MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
	 MediaType[] supportedMediaTypes = {new MediaType("text","html",Charset.forName("utf-8"))};
	 converter.setSupportedMediaTypes(Arrays.asList(supportedMediaTypes));
	 HttpMessageConverter[] messageConverters = {converter};
	 adapter.setMessageConverters(Arrays.asList(messageConverters));
	 return adapter;
 }
}
